#include <gtest/gtest.h>

#include "memdb/memdb.h"
#include "memdb/impl/mock/MockTable.h"
#include "app/app.h"

TEST(TestBiz, testApplication){
	app::Application app;
	app.run();
}




TEST(TestBiz, testDataGrid){
	//memdb::impl::MockDB db("./data");
	memdb::impl::mock::MockTable table100; //= db.tables().get("order").;
	ASSERT_EQ((size_t)0, table100.count());

	{
		app::DataGrid dg;
		ASSERT_EQ(0, dg.current());


		dg.setDataSource(table100);
		ASSERT_EQ(&table100, &(dg.dataSource()));
		ASSERT_EQ(0, dg.current());


		dg.down(1);
		ASSERT_EQ(0, dg.current());

		dg.up(1);
		ASSERT_EQ(0, dg.current());

		dg.pagesDown(1);
		ASSERT_EQ(0, dg.current());

		dg.pagesUp(1);
		ASSERT_EQ(0, dg.current());

		dg.pagesDown(10);
		ASSERT_EQ(0, dg.current());

		dg.pagesUp(10);
		ASSERT_EQ(0, dg.current());
	}
}

